Optimal. Leaf size=195 \[ -\frac {B n (b c-a d)^2 \log \left (\frac {b c-a d}{b (c+d x)}\right ) \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A+B n\right )}{b d^2}-\frac {B n (a+b x) (b c-a d) \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )}{b d}+\frac {(a+b x)^2 \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )^2}{2 b}-\frac {B^2 n^2 (b c-a d)^2 \text {Li}_2\left (\frac {d (a+b x)}{b (c+d x)}\right )}{b d^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.49, antiderivative size = 308, normalized size of antiderivative = 1.58, number of steps used = 15, number of rules used = 11, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.355, Rules used = {6742, 2492, 43, 2514, 2486, 31, 2488, 2411, 2343, 2333, 2315} \[ -\frac {B^2 n^2 (b c-a d)^2 \text {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{b d^2}+\frac {A^2 (a+b x)^2}{2 b}+\frac {A B n (b c-a d)^2 \log (c+d x)}{b d^2}+\frac {A B (a+b x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}-\frac {A B n x (b c-a d)}{d}-\frac {B^2 n (b c-a d)^2 \log \left (\frac {b c-a d}{b (c+d x)}\right ) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d^2}+\frac {B^2 n^2 (b c-a d)^2 \log (c+d x)}{b d^2}+\frac {B^2 (a+b x)^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )}{2 b}-\frac {B^2 n (a+b x) (b c-a d) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 43
Rule 2315
Rule 2333
Rule 2343
Rule 2411
Rule 2486
Rule 2488
Rule 2492
Rule 2514
Rule 6742
Rubi steps
\begin {align*} \int (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx &=\int \left (A^2 (a+b x)+2 A B (a+b x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )+B^2 (a+b x) \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )\right ) \, dx\\ &=\frac {A^2 (a+b x)^2}{2 b}+(2 A B) \int (a+b x) \log \left (e (a+b x)^n (c+d x)^{-n}\right ) \, dx+B^2 \int (a+b x) \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right ) \, dx\\ &=\frac {A^2 (a+b x)^2}{2 b}+\frac {A B (a+b x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}+\frac {B^2 (a+b x)^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )}{2 b}-\frac {(A B (b c-a d) n) \int \frac {a+b x}{c+d x} \, dx}{b}-\frac {\left (B^2 (b c-a d) n\right ) \int \frac {(a+b x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{c+d x} \, dx}{b}\\ &=\frac {A^2 (a+b x)^2}{2 b}+\frac {A B (a+b x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}+\frac {B^2 (a+b x)^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )}{2 b}-\frac {(A B (b c-a d) n) \int \left (\frac {b}{d}+\frac {-b c+a d}{d (c+d x)}\right ) \, dx}{b}-\frac {\left (B^2 (b c-a d) n\right ) \int \left (\frac {b \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{d}+\frac {(-b c+a d) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{d (c+d x)}\right ) \, dx}{b}\\ &=-\frac {A B (b c-a d) n x}{d}+\frac {A^2 (a+b x)^2}{2 b}+\frac {A B (b c-a d)^2 n \log (c+d x)}{b d^2}+\frac {A B (a+b x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}+\frac {B^2 (a+b x)^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )}{2 b}-\frac {\left (B^2 (b c-a d) n\right ) \int \log \left (e (a+b x)^n (c+d x)^{-n}\right ) \, dx}{d}+\frac {\left (B^2 (b c-a d)^2 n\right ) \int \frac {\log \left (e (a+b x)^n (c+d x)^{-n}\right )}{c+d x} \, dx}{b d}\\ &=-\frac {A B (b c-a d) n x}{d}+\frac {A^2 (a+b x)^2}{2 b}+\frac {A B (b c-a d)^2 n \log (c+d x)}{b d^2}-\frac {B^2 (b c-a d) n (a+b x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d}+\frac {A B (a+b x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}-\frac {B^2 (b c-a d)^2 n \log \left (\frac {b c-a d}{b (c+d x)}\right ) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d^2}+\frac {B^2 (a+b x)^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )}{2 b}+\frac {\left (B^2 (b c-a d)^2 n^2\right ) \int \frac {1}{c+d x} \, dx}{b d}+\frac {\left (B^2 (b c-a d)^3 n^2\right ) \int \frac {\log \left (-\frac {-b c+a d}{b (c+d x)}\right )}{(a+b x) (c+d x)} \, dx}{b d^2}\\ &=-\frac {A B (b c-a d) n x}{d}+\frac {A^2 (a+b x)^2}{2 b}+\frac {A B (b c-a d)^2 n \log (c+d x)}{b d^2}+\frac {B^2 (b c-a d)^2 n^2 \log (c+d x)}{b d^2}-\frac {B^2 (b c-a d) n (a+b x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d}+\frac {A B (a+b x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}-\frac {B^2 (b c-a d)^2 n \log \left (\frac {b c-a d}{b (c+d x)}\right ) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d^2}+\frac {B^2 (a+b x)^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )}{2 b}+\frac {\left (B^2 (b c-a d)^3 n^2\right ) \operatorname {Subst}\left (\int \frac {\log \left (-\frac {-b c+a d}{b x}\right )}{x \left (\frac {-b c+a d}{d}+\frac {b x}{d}\right )} \, dx,x,c+d x\right )}{b d^3}\\ &=-\frac {A B (b c-a d) n x}{d}+\frac {A^2 (a+b x)^2}{2 b}+\frac {A B (b c-a d)^2 n \log (c+d x)}{b d^2}+\frac {B^2 (b c-a d)^2 n^2 \log (c+d x)}{b d^2}-\frac {B^2 (b c-a d) n (a+b x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d}+\frac {A B (a+b x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}-\frac {B^2 (b c-a d)^2 n \log \left (\frac {b c-a d}{b (c+d x)}\right ) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d^2}+\frac {B^2 (a+b x)^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )}{2 b}-\frac {\left (B^2 (b c-a d)^3 n^2\right ) \operatorname {Subst}\left (\int \frac {\log \left (-\frac {(-b c+a d) x}{b}\right )}{\left (\frac {-b c+a d}{d}+\frac {b}{d x}\right ) x} \, dx,x,\frac {1}{c+d x}\right )}{b d^3}\\ &=-\frac {A B (b c-a d) n x}{d}+\frac {A^2 (a+b x)^2}{2 b}+\frac {A B (b c-a d)^2 n \log (c+d x)}{b d^2}+\frac {B^2 (b c-a d)^2 n^2 \log (c+d x)}{b d^2}-\frac {B^2 (b c-a d) n (a+b x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d}+\frac {A B (a+b x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}-\frac {B^2 (b c-a d)^2 n \log \left (\frac {b c-a d}{b (c+d x)}\right ) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d^2}+\frac {B^2 (a+b x)^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )}{2 b}-\frac {\left (B^2 (b c-a d)^3 n^2\right ) \operatorname {Subst}\left (\int \frac {\log \left (-\frac {(-b c+a d) x}{b}\right )}{\frac {b}{d}+\frac {(-b c+a d) x}{d}} \, dx,x,\frac {1}{c+d x}\right )}{b d^3}\\ &=-\frac {A B (b c-a d) n x}{d}+\frac {A^2 (a+b x)^2}{2 b}+\frac {A B (b c-a d)^2 n \log (c+d x)}{b d^2}+\frac {B^2 (b c-a d)^2 n^2 \log (c+d x)}{b d^2}-\frac {B^2 (b c-a d) n (a+b x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d}+\frac {A B (a+b x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}-\frac {B^2 (b c-a d)^2 n \log \left (\frac {b c-a d}{b (c+d x)}\right ) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b d^2}+\frac {B^2 (a+b x)^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )}{2 b}-\frac {B^2 (b c-a d)^2 n^2 \text {Li}_2\left (\frac {d (a+b x)}{b (c+d x)}\right )}{b d^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 0.73, size = 656, normalized size = 3.36 \[ -\frac {2 a^2 A B n}{b}-\frac {2 a^2 B^2 n \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}-\frac {2 a^2 B^2 n^2 \log (c+d x)}{b}-\frac {a^2 B^2 n^2 \log ^2(a+b x)}{2 b}-\frac {2 a^2 B^2 n^2}{b}+a A^2 x+\frac {B n \log (a+b x) \left (a d \left (a d (A+3 B n)+a B d \log \left (e (a+b x)^n (c+d x)^{-n}\right )-b B c n\right )+B n (b c-a d)^2 \log \left (\frac {b (c+d x)}{b c-a d}\right )+b B c n (2 a d-b c) \log (c+d x)\right )}{b d^2}+A b B x^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )+2 a A B x \log \left (e (a+b x)^n (c+d x)^{-n}\right )-\frac {2 a A B c n \log (c+d x)}{d}+a A B n x+\frac {b B^2 c^2 n \log (c+d x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{d^2}+\frac {B^2 n^2 (b c-a d)^2 \text {Li}_2\left (\frac {d (a+b x)}{a d-b c}\right )}{b d^2}+\frac {1}{2} b B^2 x^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )+a B^2 x \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )+a B^2 n x \log \left (e (a+b x)^n (c+d x)^{-n}\right )-\frac {2 a B^2 c n \log (c+d x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{d}-\frac {b B^2 c n x \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{d}-\frac {a B^2 c n^2 \log ^2(c+d x)}{d}-\frac {a B^2 c n^2 \log (c+d x)}{d}+\frac {a B^2 c n^2}{d}+\frac {1}{2} A^2 b x^2+\frac {A b B c^2 n \log (c+d x)}{d^2}-\frac {A b B c n x}{d}+\frac {b B^2 c^2 n^2 \log ^2(c+d x)}{2 d^2}+\frac {b B^2 c^2 n^2 \log (c+d x)}{d^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [F] time = 0.57, size = 0, normalized size = 0.00 \[ {\rm integral}\left (A^{2} b x + A^{2} a + {\left (B^{2} b x + B^{2} a\right )} \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right )^{2} + 2 \, {\left (A B b x + A B a\right )} \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ), x\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (b x + a\right )} {\left (B \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A\right )}^{2}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [C] time = 2.09, size = 10210, normalized size = 52.36 \[ \text {output too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [B] time = 6.91, size = 779, normalized size = 3.99 \[ A B b x^{2} \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + \frac {1}{2} \, A^{2} b x^{2} + 2 \, A B a x \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A^{2} a x + \frac {2 \, {\left (\frac {a e n \log \left (b x + a\right )}{b} - \frac {c e n \log \left (d x + c\right )}{d}\right )} A B a}{e} - \frac {{\left (\frac {a^{2} e n \log \left (b x + a\right )}{b^{2}} - \frac {c^{2} e n \log \left (d x + c\right )}{d^{2}} + \frac {{\left (b c e n - a d e n\right )} x}{b d}\right )} A B b}{e} + \frac {{\left ({\left (n^{2} + n \log \relax (e)\right )} b c^{2} - {\left (n^{2} + 2 \, n \log \relax (e)\right )} a c d\right )} B^{2} \log \left (d x + c\right )}{d^{2}} + \frac {{\left (b^{2} c^{2} n^{2} - 2 \, a b c d n^{2} + a^{2} d^{2} n^{2}\right )} {\left (\log \left (b x + a\right ) \log \left (\frac {b d x + a d}{b c - a d} + 1\right ) + {\rm Li}_2\left (-\frac {b d x + a d}{b c - a d}\right )\right )} B^{2}}{b d^{2}} - \frac {B^{2} a^{2} d^{2} n^{2} \log \left (b x + a\right )^{2} - B^{2} b^{2} d^{2} x^{2} \log \relax (e)^{2} + 2 \, {\left (b^{2} c^{2} n^{2} - 2 \, a b c d n^{2}\right )} B^{2} \log \left (b x + a\right ) \log \left (d x + c\right ) - {\left (b^{2} c^{2} n^{2} - 2 \, a b c d n^{2}\right )} B^{2} \log \left (d x + c\right )^{2} + 2 \, {\left (b^{2} c d n \log \relax (e) - {\left (n \log \relax (e) + \log \relax (e)^{2}\right )} a b d^{2}\right )} B^{2} x + 2 \, {\left (a b c d n^{2} - {\left (n^{2} + n \log \relax (e)\right )} a^{2} d^{2}\right )} B^{2} \log \left (b x + a\right ) - {\left (B^{2} b^{2} d^{2} x^{2} + 2 \, B^{2} a b d^{2} x\right )} \log \left ({\left (b x + a\right )}^{n}\right )^{2} - {\left (B^{2} b^{2} d^{2} x^{2} + 2 \, B^{2} a b d^{2} x\right )} \log \left ({\left (d x + c\right )}^{n}\right )^{2} - 2 \, {\left (B^{2} b^{2} d^{2} x^{2} \log \relax (e) + B^{2} a^{2} d^{2} n \log \left (b x + a\right ) + {\left (a b d^{2} {\left (n + 2 \, \log \relax (e)\right )} - b^{2} c d n\right )} B^{2} x + {\left (b^{2} c^{2} n - 2 \, a b c d n\right )} B^{2} \log \left (d x + c\right )\right )} \log \left ({\left (b x + a\right )}^{n}\right ) + 2 \, {\left (B^{2} b^{2} d^{2} x^{2} \log \relax (e) + B^{2} a^{2} d^{2} n \log \left (b x + a\right ) + {\left (a b d^{2} {\left (n + 2 \, \log \relax (e)\right )} - b^{2} c d n\right )} B^{2} x + {\left (b^{2} c^{2} n - 2 \, a b c d n\right )} B^{2} \log \left (d x + c\right ) + {\left (B^{2} b^{2} d^{2} x^{2} + 2 \, B^{2} a b d^{2} x\right )} \log \left ({\left (b x + a\right )}^{n}\right )\right )} \log \left ({\left (d x + c\right )}^{n}\right )}{2 \, b d^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [F] time = 0.00, size = -1, normalized size = -0.01 \[ \int {\left (A+B\,\ln \left (\frac {e\,{\left (a+b\,x\right )}^n}{{\left (c+d\,x\right )}^n}\right )\right )}^2\,\left (a+b\,x\right ) \,d x \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: HeuristicGCDFailed} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________